package com.top.ruizhong.main.access

import com.blankj.utilcode.util.SPStaticUtils
import com.module.lemlin.base.BaseAbstractActivity
import com.top.ruizhong.R
import com.top.ruizhong.app.TOKEN
import com.top.ruizhong.main.host.MainActivity

class SplashActivity : BaseAbstractActivity() {
    override val layoutResId: Int
        get() = R.layout.activity_splash

    override fun initData() {
        Thread {
            Thread.sleep((1500))
            runOnUiThread { action() }
        }.start()
    }

    private fun action() {
        val token: String? = SPStaticUtils.getString(TOKEN, (null))
        if (token == null) {
            AccessActivity.open(activity = this)
        } else {
            MainActivity.open(activity = this)
        }
    }

    override fun onStop() {
        super.onStop()
        finish()
    }
}